import request from '../utils/request'
let token = localStorage.token
let service = {
    getAllSiders(username){
        return request({
            method:'GET',
            url:`/menu/${username}`,
            headers:{
                'Authentication':token,
                'Content-Type':'application/x-www-form-urlencoded'
            }
        })
    },
    getRoleMenus(param){
        return request({
            method:'GET',
            url:'/menu',
            headers:{
                'Authentication':token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            params:{
                menuName:param.menuName,
                createTimeFrom:param.createTimeFrom,
                createTimeTo:param.createTimeTo,
            }
        })
    },
    delMenu(id){
        return request({
            method:'delete',
            url:`/menu/${id}`
        })
    },
    updateMenu(param){
        console.log(param);
        return request({
            method:'put',
            url:'menu',
            data:param,
            headers:{
                'Authentication':token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
        })
    },
    addMenu(param){
        console.log(param);
        return request({
            method:'POST',
            url:'/menu',
            headers:{
                'Authentication':token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            data:param
        })
    }
}

export default service